package com.fmy.jurisdiction.modular.wrapper;

import lombok.Getter;

import java.util.List;

/**
 * @author Mr.fmy
 * @version 1.0.0
 * @ClassName ObjectWrapper
 * @Description TODO 抽象转换类
 * @createTime 2019/9/9 11:01
 */
public abstract class ObjectWrapper {
    @Getter
    private Object obj;

    public ObjectWrapper(Object obj) {
        this.obj = obj;
    }

    public Object wrapper() {
        if (obj != null) {
            if (obj instanceof List) {
                ((List) obj).forEach(this::wrp);
            } else {
                wrp(obj);
            }
        }
        return obj;
    }

    protected abstract void wrp(Object t);
}
